import { IDBSchema, IDBSchemaStoreInfoType } from '../db/types'

export const DB_NAME = 'nim-accid'
export const DB_VERSION = 1

export const DB_SCHEMA: IDBSchema = [
  // {
  //   storeName: 'log',
  //   primaryKey: {
  //     keyPath: 'id',
  //     autoIncrement: true
  //   },
  //   indexes: [
  //     {
  //       keyName: 'time',
  //       unique: false
  //     }
  //   ],
  //   infos: [
  //     {
  //       name: 'id',
  //       type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_NUMBER
  //     },
  //     {
  //       name: 'iid',
  //       type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_NUMBER
  //     },
  //     {
  //       name: 'level',
  //       type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_NUMBER
  //     },
  //     {
  //       name: 'text',
  //       type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
  //     },
  //     {
  //       name: 'time',
  //       type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_NUMBER
  //     }
  //   ]
  // },
  {
    storeName: 'msg1',
    primaryKey: {
      keyPath: 'idClient',
      autoIncrement: false
    },
    indexes: [
      {
        keyName: 'sessionId',
        unique: false
      },
      {
        keyName: 'time',
        unique: false
      },
      {
        keyName: 'status',
        unique: false
      },
      {
        keyName: 'sessionTime',
        keyPath: ['sessionId', 'time'],
        unique: false
      }
    ],
    infos: [
      {
        name: 'cc',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'flow',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'from',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'fromClientType',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'fromNick',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'idClient',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'idServer',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'isHistoryable',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'isLocal',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'isOfflinable',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'isPushable',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'isReplyMsg',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'isRoamingable',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'isSyncable',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'isUnreadable',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'needMsgReceipt',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'needPushNick',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'resend',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_BOOLEAN
      },
      {
        name: 'scene',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'sessionId',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'status',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'target',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'text',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'time',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_NUMBER
      },
      {
        name: 'to',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'type',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      },
      {
        name: 'userUpdateTime',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_NUMBER
      },
      {
        name: 'content',
        type: IDBSchemaStoreInfoType.IDB_SCHEMA_ITEM_INFO_TYPE_STRING
      }
    ]
  }
]
